package com.yongbao.model.util;

import com.yongbao.model.dtomapper.DishOrderDishDtoMapper;
import com.yongbao.model.domain.DishOrderDishDO;
import com.yongbao.model.vo.DishOrderDishVO;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhanghong
 */
public class DishOrderDishConvert {

    public static List<DishOrderDishVO> buildDishOrderDishVoList(List<DishOrderDishDO> dishOrderDishDOList) {
        if (CollectionUtils.isEmpty(dishOrderDishDOList)) {
            return Lists.newArrayList();
        }
        List<DishOrderDishVO> dishOrderDishVOList = new ArrayList<>();
        for (DishOrderDishDO dishOrderDishDO : dishOrderDishDOList) {
            dishOrderDishVOList.add(DishOrderDishDtoMapper.INSTANCE.do2VO(dishOrderDishDO));
        }

        return dishOrderDishVOList;
    }
}
